const net = require('net')

const server = net.createServer(c => {
  console.log('服务器已连接')
  c.on('end', () => {
    console.log(`服务器已断开`)
  })
  c.on('data', data => {
    console.log('服务端socket 读数据')
    console.log(data.toString())
  })
  c.write('Hello Cwy! \r\n')

  c.pipe(c)
})

server.listen(8888, function () { // Listening监听器
  console.log('服务器已绑定')
})
